package com.ruoyi.web.controller.api;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.Images;
import com.ruoyi.system.domain.News;
import com.ruoyi.system.service.impl.ImagesServiceImpl;
import com.ruoyi.system.service.impl.NewsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/api")
public class wxNewsController {

   @Autowired
    NewsServiceImpl newsService;
   @Autowired
    ImagesServiceImpl imagesService;

   @RequestMapping("/newsList")
    public AjaxResult showAllNews(){
//    查询数据库
        News news=new News();
        List<News> newsList = newsService.selectNewsList(news);
        return AjaxResult.success("success",newsList);
    }
    @RequestMapping("/imagesList")
    public AjaxResult showAllimages(){
//    查询数据库
        Images images=new Images();
        List<Images> imagesList = imagesService.selectImagesList(images);
        return AjaxResult.success("success",imagesList);
    }

}
